"""
自定义异常类
"""


class FlowScapeException(Exception):
    """基础异常类"""

    def __init__(self, code: str, message: str, details: any = None):
        self.code = code
        self.message = message
        self.details = details
        super().__init__(self.message)


class InvalidParameterError(FlowScapeException):
    """参数无效异常"""

    def __init__(self, message: str = "请求参数无效", details: any = None):
        super().__init__("INVALID_PARAMETER", message, details)


class ModelNotLoadedError(FlowScapeException):
    """模型未加载异常"""

    def __init__(self, message: str = "模型未加载", details: any = None):
        super().__init__("MODEL_NOT_LOADED", message, details)


class PredictionFailedError(FlowScapeException):
    """预测失败异常"""

    def __init__(self, message: str = "预测失败", details: any = None):
        super().__init__("PREDICTION_FAILED", message, details)


class DataNotFoundError(FlowScapeException):
    """数据不存在异常"""

    def __init__(self, message: str = "数据不存在", details: any = None):
        super().__init__("DATA_NOT_FOUND", message, details)
